<template>
  <div>
    <transition name="fade">
      <div v-show="isShow">123</div>
    </transition>
    <button @click="toggle">测试1</button>
  </div>
</template>

<script>
import { ref } from 'vue'
export default {
  name: 'Test',

  setup () {
    const isShow = ref(true)
    const toggle = () => {
      isShow.value = !isShow.value
    }
    return { isShow, toggle }
  }
}
</script>

<style lang="less" scoped>
.fade-leave-from ,.fade-enter-to{
    opacity: 1
}
.fade-leave-active,.fade-enter-active{
  transition:all 3s;
}
.fade-leave-to,.fade-enter-from{
    opacity: 0
}
</style>
